//
//  Macro.swift
//  HYOnline
//
//  Created by zhuxuhong on 2017/2/20.
//  Copyright © 2017年 zhuxuhong. All rights reserved.
//

import UIKit

let appRootTabBarVC = app.keyWindow!.rootViewController as! UITabBarController

let app = UIApplication.shared

let appDelegate = app.delegate as! AppDelegate

var isTeacher: Bool{
	#if TEACHER
		return true
	#else
		return false
	#endif
}


typealias ViewActionCallback = ((_ type: Any?, _ info: Any?, _ sender: UIView?) -> Void)


struct Segue {
    static let login = (
        resetPassword: "toResetPasswordPage", //忘记密码
        registerAccount: "toRegisterAccountPage", //注册账号
        registerDidSucceedUnwind: "registerPageUnwind", //注册成功
        resetPasswordDidSucceedUnwind: "registerPageUnwind", //重置密码成功
        registerForSelectSchool: "toSelectSchoolPage", //选择学校
        registerForSelectSchoolUnwind: "selectSchoolPageUnwind", //选择学校返回
        registerDidSucceedUnwind: "registerPageUnwind", //注册成功
        resetPasswordDidSucceedUnwind: "registerPageUnwind", //重置密码成功
		studentAuthorize: "toAuthorizePage", //去认证
		studentAuthorizeDidSucceedUnwind: "authorizePageUnwind" //认证成功
    )
    static let learning = (
        learn: "toLearningLearnPage",
		practice: "toLearningPracticePage",
		quiz: "toLearningQuizPage",
		recommend: "toLearningRecommendPage",
		weakKnowledge: "toLearningWeakKnowledgePage"
    )
    static let assignment = (
        todo: "toAssignmentTodoPage",
        submitted: "toAssignmentSubmittedPage",
        finished: "toAssignmentFinishedPage"
	)
	static let profile = (
		styleTesting: "toProfileStyleTestingPage",
		styleResult: "toProfileStyleResultPage"
	)
    static let common = (
        selectClassUnwind: "selectClassPageUnwind",
        xxx: ""
    )
}

struct StoryboardID {
    static let common = (
        selectClass: "SelectClassVC",
        selectSchool: "SelectSchoolVC",
        password: "PasswordVC",
        register: "RegisterVC",
        welcome: "WelcomeVC",
        styleTestingResult: "StyleTestingResultVC",
        videoPlay: "VideoPlayVC",
        comment: "CommentVC"
    )
    static let login = (
        main: "LoginMainVC",
        registerAccount: "RegisterAccountVC",
        forgetPassword: "ForgetPasswordVC"
    )
    static let quiz = (
        main: "QuizMainVC",
        publish: "QuizPublishVC",
        correct: "QuizCorrectVC",
        correctDetail: "QuizCorrectDetailVC",
        paperKnowledgeNav: "QuizPaperKnowledgeNavVC",
        paperKnowledge: "QuizPaperKnowledgeVC"
    )
    static let assign = (
        main: "AssignMainVC",
        publish: "AssignPublishVC",
        correct: "AssignCorrectVC",
        correctDetail: "AssignCorrectDetailVC"
    )
    static let profile = (
        main: "ProfileMainVC",
        xxx: ""
    )
}

public enum Font: Int {
	case p10 = 10 
	case p11 = 11
	case p12 = 12 
	case p13 = 13
	case p14 = 14 
	case p15 = 15
	case p16 = 16 
	case p17 = 17
	case p18 = 18
	case p20 = 20
	case p30 = 30
	case p40 = 40
	
	public var system: UIFont{
		return .systemFont(ofSize: self.rawValue.cgFloat)
	}
	
	public var boldSystem: UIFont{
		return .boldSystemFont(ofSize: self.rawValue.cgFloat)
	}
	
	public var lightSystem: UIFont{
		if #available(iOS 8.2, *) {
			return .systemFont(ofSize: self.rawValue.cgFloat, weight: UIFont.Weight.light)
		} else {
			
		}
		return .systemFont(ofSize: self.rawValue.cgFloat)
	}
}






